# $Id: PKGBUILD 89642 2013-04-30 20:49:34Z guillaume $
# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: fancris3 <fancris3 at gmail.com>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=terminator
pkgver=0.97
pkgrel=1
pkgdesc='Terminal emulator that supports tabs and grids'
arch=('any')
url='http://www.tenshu.net/p/terminator.html'
license=('GPL2')
# Note: the package named 'vte3' is actually vte for GTK 3
# and terminator seems to require vte for GTK 2
depends=('vte' 'pygtk' 'xdg-utils' 'python2-notify' 'python2-keybinder2')
makedepends=('desktop-file-utils' 'gettext' 'intltool')
install=terminator.install
source=("http://launchpad.net/terminator/trunk/${pkgver}/+download/${pkgname}-${pkgver}.tar.gz")
sha256sums=('0281b568913f392eec92ebee3c6fea15afe4f4e01869bad38d9efe0eb305be49')

build() {
    cd ${srcdir}/trunk

    # python2 fix
    for file in terminatorlib/{,plugins/}*.py; do
        sed -i 's_#!/usr/bin/python_#!/usr/bin/python2_' $file
        sed -i 's_#!/usr/bin/env python_#!/usr/bin/env python2_' $file
    done

    python2 setup.py build
}

package() {
    cd ${srcdir}/trunk

    python2 setup.py install --skip-build --root=${pkgdir}

    rm -f ${pkgdir}/usr/share/applications/${pkgname}.desktop
    rm -f ${pkgdir}/usr/share/icons/hicolor/icon-theme.cache
    install -D -m644 ${srcdir}/trunk/data/${pkgname}.desktop.in ${pkgdir}/usr/share/applications/${pkgname}.desktop
    sed -i 's|_||' ${pkgdir}/usr/share/applications/${pkgname}.desktop
}
